﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Runtime.Serialization;
using System.Runtime.Serialization.Json;
using System.Data;

/// <summary>
/// 返回結果
/// </summary>
[DataContract]
class MarkerClass_Result
{
    /// <summary>
    /// ID
    /// </summary>
    [DataMember(Order = 0)]
    public string id { get; set; }
    /// <summary>
    /// 名稱
    /// </summary>
    [DataMember(Order = 1)]
    public string name { get; set; }
}

public partial class Service_MarkerClass : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        using (MyDb.Db db = new MyDb.Db())
        {
            IList<MarkerClass_Result> list = new List<MarkerClass_Result>();
            MarkerClass_Result item = null;
            using (DataTable dt2 = db.getDataTable("select ID,NameZh from MarkerClass order by Orders", "mess2"))
            {
                foreach (DataRow rs in dt2.Rows)
                {
                    item = new MarkerClass_Result();
                    item.name = rs["NameZh"].ToString().Trim();
                    item.id = rs["ID"].ToString().Trim();
                    list.Add(item);
                }
            }
            Response.Write(string.Format("{{\"markerclass\":{0}}}", MyDb.JSON.stringify(list)));
            list.Clear();
            list = null;
        }
        Response.End();
    }
}
